﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using Omu.Awesome.Core;
using Omu.Awesome.Mvc;
using XPressify.Data;

namespace XPressify.Models
{
    public class ProfileViewModel
    {
        public Guid ViewerUserId { get; set; }
        public Guid ProfileAlbumId { get; set; }
        public Guid WallAlbumId { get; set; }
        public User OwnerUser { get; set; }
        public string OwnerProfilePicturePath { get; set; }
        public string ViewerProfilePicturePath { get; set; }
        public bool IsOwner { get; set; }
        public bool IsFriend { get; set; }
        public Friend[] AllRelationshipChild { get; set; }
        public Friend[] AllRelationshipSibling { get; set; }
        public Friend[] AllRelationshipParent { get; set; }
        public Friend[] AllRelationshipUncleAunt { get; set; }
        public Friend[] AllRelationshipCousin { get; set; }
        public Friend[] AllRelationshipGrandparent { get; set; }
        public Friend[] AllRelationshipGrandchild { get; set; }
        public Friend[] AllRelationshipNephewNiece { get; set; }
        public User previousLoveRelationshipUser { get; set; }
        public bool LoveRelationshipWithHimself { get; set; }
        public string LoveRelationshipType { get; set; }
        public bool IsBlocked { get; set; }
        public bool AnyFriendRelationship { get; set; }
        public Dictionary<Post, List<Post>> Posts { get; set; }
        public bool OwnerRequestedFriendshipExist { get; set; }
        public Relationship OwnerRequestedFriendshipRel { get; set; }
        public bool IsAjaxRequest { get; set; }
    }

    public class ProfileEditModel
    {
        public Guid UserId { get; set; }
        
        [Required]
        [Display(Name = "First name")]
        public string FirstName { get; set; }

        [Required]
        [Display(Name = "Last name")]
        public string LastName { get; set; }

        [Required]
        [Display(Name = "Gender")]
        public string Gender { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Email address")]
        [RegularExpression(
            @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
            )]
        public string Email { get; set; }

        [Display(Name = "Username")]
        public string Username { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [Display(Name = "Birthday")]
        public DateTime Birthday { get; set; }

        [Required]
        [Display(Name = "Privacy type")]
        public short PrivacyType { get; set; }

        public Guid PreviousLoveRelationshipId { get; set; }

        public bool ChangeLoveRelationship { get; set; }

    }

    public class PostponedUser
    {
        public Guid Id { get; set; }
        public Guid RelationshipId { get; set; }
        public string Name { get; set; }
        public string Type { get; set; }
        public short BaseSubjectType { get; set; }
        public short RelationshipType { get; set; }
    }

    public class PostponedListModel
    {
        public PostponedUser[] Users { get; set; }
        public Guid CurrentUserId { get; set; }
        public bool IsAjaxRequest { get; set; }
    }

    public class RelationshipLoveDeleteModel
    {
        public Guid UserId { get; set; }
        public Friend RelationshipUser { get; set; }
        public string RelationshipStatus { get; set; }
        public Relationship Relationship { get; set; }
    }

    public class RelationshipLoveEditModel
    {
        [Display(Name = "Relationship type")]
        public short RelationshipType { get; set; }

        public bool AnyPreviousRelationship { get; set; }

        [UIHint("Lookup")]
        [Lookup(Controller = "FriendsLookup")]
        public Guid SelectedUser { get; set; }

        public Guid CurrentUserId { get; set; }
    }

    public class RelationshipLoveChangeModel
    {
        public Guid CurrentUserId { get; set; }
        [Display(Name = "Relationship type")]
        public short RelationshipType { get; set; }
    }

    public class RelationshipFamilyEditModel
    {
        public Guid CurrentUserId { get; set; }

        [Display(Name = "Relationship type")]
        public short RelationType { get; set; }

        [Required]
        public Guid SelectedUser { get; set; }
    }

    public class RelationshipFamilyDeleteModel
    {
        public Guid CurrentUserId { get; set; }
        public Friend[] AllFamilyUsers { get; set; }

    }

    public class FriendListDeleteModel
    {
        public Guid CurrentUserId { get; set; }

        [Required]
        public IEnumerable<Guid> UsersSelected { get; set; }
    }

    public class ProfileFriendListModel : Pageable<Friend>
    {
        public Guid OwnerUserId { get; set; }
        public Friend[] AllFriends { get; set; }
        public bool IsOwner { get; set; }
        public Guid Id { get; set; }
    }

    public class Friend
    {
        public Guid Id { get; set; }
        public string FullName { get; set; }
        public string ProfilePicturePath { get; set; }
        public bool IsSelected { get; set; }
        public string RelationshipType { get; set; }
        public bool ConfirmFriend { get; set; }
        public bool AddFriend { get; set; }
        public Guid RelationshipId { get; set; }
    }

    public class FriendListTablePopupModel
    {
        public string SearchedText { get; set; }
        public Friend[] Friends { get; set; }
        public Guid Id { get; set; }
    }

    public class ProfilePost
    {
        public Post Post { get; set; }
        public string OwnerProfilePicturePath { get; set; }
    }

    public class ProfileInfoModel
    {
        public User OwnerUser { get; set; }
        public bool Show { get; set; }
        public Relationship LoveRelationship { get; set; }
        public string RelationshipType { get; set; }
        public User LoveRelationshipUser { get; set; }
        public bool IsOwner { get; set; }

        public Friend[] AllRelationshipChild { get; set; }
        public Friend[] AllRelationshipSibling { get; set; }
        public Friend[] AllRelationshipParent { get; set; }
        public Friend[] AllRelationshipUncleAunt { get; set; }
        public Friend[] AllRelationshipCousin { get; set; }
        public Friend[] AllRelationshipGrandparent { get; set; }
        public Friend[] AllRelationshipGrandchild { get; set; }
        public Friend[] AllRelationshipNephewNiece { get; set; }
    }

    public class FamilyListModel
    {
        public Friend[] AllRelationshipChild { get; set; }
        public Friend[] AllRelationshipSibling { get; set; }
        public Friend[] AllRelationshipParent { get; set; }
        public Friend[] AllRelationshipUncleAunt { get; set; }
        public Friend[] AllRelationshipCousin { get; set; }
        public Friend[] AllRelationshipGrandparent { get; set; }
        public Friend[] AllRelationshipGrandchild { get; set; }
        public Friend[] AllRelationshipNephewNiece { get; set; }
    }
}